//
//  MsgUserUNKNOWCell.swift
//  swiftim
//
//  Created by yangjian on 2023/6/13.
//

import Foundation


class MsgUserUnknownCell : MsgUserBaseCell {
    
    
    
    let textView = UITextView()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.configMsgSubViews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func configMsgSubViews() {
        configBubbleView(superView: msgBackgroundView, aboveView: msgContentView)

        msgContentView.addSubview(textView)
        
        stateLabel.snp.makeConstraints { make in
            make.bottom.equalTo(self.msgContentView.snp.bottom)
            make.right.equalTo(self.msgContentView.snp.left).offset(-20)
        }
        
        textView.snp.remakeConstraints { make in
            make.top.equalTo(msgContentView)
            make.bottom.equalTo(msgContentView)
            make.left.equalTo(msgContentView)
            make.right.equalTo(msgContentView)
        }
            
        
        textView.backgroundColor = UIColor.clear
        textView.textContainer.lineFragmentPadding = 0
        textView.textContainerInset = UIEdgeInsets.zero
        textView.isEditable = false
        textView.isScrollEnabled = false
        textView.isUserInteractionEnabled = false
        textView.setContentCompressionResistancePriority(.required, for: .horizontal)
        textView.setContentCompressionResistancePriority(.required, for: .vertical)
        textView.setContentHuggingPriority(.required, for: .horizontal)
        textView.setContentHuggingPriority(.required, for: .vertical)

    }
    
    override func resetSubViewsLayout(showName: Bool, showHead: Bool) {
        super.resetSubViewsLayout(showName: showName, showHead: showHead)
        resetBubbleleView(aboveView: msgContentView)

    }
        
    override func bindFromModel(_ model: MsgCellBaseModel) {
        super.bindFromModel(model)
        textView.attributedText = model.show_text
    }

    
    
    
    
    
    
}
